// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html

const {ccclass, property} = cc._decorator;

import MainControl from "./mainControl";

@ccclass
export default class GameOver extends cc.Component {

    @property(MainControl)
    mainControl : MainControl = null;

    @property(cc.Label)
    score: cc.Label = null;

    @property(cc.Label)
    best: cc.Label = null;

    start () {
        this.mainControl = cc.find("persistentNode").getComponent("mainControl");


        let score = cc.sys.localStorage.getItem('score');
        let best = cc.sys.localStorage.getItem('best');
        this.score.string = score + '';
        this.best.string = best + '';
    }

    restartGame(){
        this.mainControl.beginGame();
    }
    // update (dt) {}
}
